// implementation of thread pool
//

#include <pthread.h>

#define NUM_THREADS 8
#define NUM_TASKS_Q 8

typedef struct {
    void* fn(void*);	
	void* args;
} task_t;

typedef struct {
	task_t** task_queqe; // [NUM_TASKS_Q]
	size_t head;
	size_t tail;
	size_t sz;
	pthread_mutex_t* mtx;
	pthread_cond_t* empty_cond;
	pthread_cond_t* full_cond;
} task_q;

int init_task_q(task_q* tq, size_t sz);
int free_task_q(task_q* tq);
int isempty_task_q(task_q* tq_ptr);
int isfull_task_q(task_q* tq_ptr);
task_t* de_task_q(task_q* tq_ptr); // block caller when task_q is empty 
int en_task_q(task_q* tq_ptr, task_t* t); // block caller when task_q is full

typedef struct {


} threadpool;
